package com.atguigu.gulimallflow.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.atguigu.gulimallflow.entity.ActEvtLogEntity;
import com.atguigu.gulimallflow.service.ActEvtLogService;
import utils.PageUtils;
import utils.R;



/**
 *
 *
 * @author humingyang
 * @email humingyang@163.com
 * @date 2022-04-10 15:02:52
 */
@RestController
@RequestMapping("gulimallflow/actevtlog")
public class ActEvtLogController {
    @Autowired
    private ActEvtLogService actEvtLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("gulimallflow:actevtlog:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = actEvtLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{logNr}")
    //@RequiresPermissions("gulimallflow:actevtlog:info")
    public R info(@PathVariable("logNr") Long logNr){
		ActEvtLogEntity actEvtLog = actEvtLogService.getById(logNr);

        return R.ok().put("actEvtLog", actEvtLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("gulimallflow:actevtlog:save")
    public R save(@RequestBody ActEvtLogEntity actEvtLog){
		actEvtLogService.save(actEvtLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("gulimallflow:actevtlog:update")
    public R update(@RequestBody ActEvtLogEntity actEvtLog){
		actEvtLogService.updateById(actEvtLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("gulimallflow:actevtlog:delete")
    public R delete(@RequestBody Long[] logNrs){
		actEvtLogService.removeByIds(Arrays.asList(logNrs));

        return R.ok();
    }

}
